package ar.com.cubika.trainees.view.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ar.com.cubika.trainees.bean.transportes.Empresa;

public class TransportesServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    protected void writeHtmlHead(Empresa empr, PrintWriter output) {
        output.println("<head>");
        output.println("    <meta content=\"text/html\"/>");
        output.println("    <link rel=\"stylesheet\"");
        output.println("          href=\"css/modesto.css\"");
        output.println("          type=\"text/css\"/>");
        output.println("    <title>" + empr.getNombre() + "</title>");
        output.println("</head>");
    }

    protected void writeEndOfPage(PrintWriter output) {
        this.writeEndOfPage("", output);
    }

    protected void writeEndOfPage(String footer, PrintWriter output) {
        output.println("    <hr/>");
        output.println(footer);
        output.println("</body>");
        output.println("</html>");
    }

    protected String buildTitulo(String texto) {
        return "<span class=\"titulo\">" + texto + "</span> ";
    }

    protected Empresa getEmpresa() {
        return (Empresa) this.getServletContext().getAttribute("empresa");
    }

}
